from pyspark.context import SparkContext

sc = SparkContext(master='local',appName='wordcount')

student_rdd = sc.textFile('../../data/students.txt')

def map_fun(stu):
    print(f'map_fun:{stu}')
    return stu.split(',')[-1]

class_rdd = student_rdd.map(map_fun)

class_rdd.cache()

class_rdd.foreach(print)

class_rdd.foreach(print)

class_rdd.saveAsTextFile('../../data/clazz')

while True:
    pass